<!--#include file="conn.asp"-->
<!--#include file="chkuser.asp"-->
<%
call adminRight(1)

ID=request("ID")
ClassName=Replace_Text(request("ClassName"))
ClassIntro=trim(request("ClassIntro"))
pic=request("pic")

if request("action")="add" then
	Set rs = Server.CreateObject("ADODB.Recordset")
	sql="select * from productclass"
	rs.open sql,conn,1,3
	rs.addnew
	rs("ClassName")=ClassName
	rs("ClassIntro")=ClassIntro
	if ID<>"" then
		rs("ParentClassID")=ID
	end if
	rs("Pic")=Pic
	rs.update
	rs.close
	Set rs=nothing
	alert("类别添加成功！")
	Go("Admin_ProductClass.asp?showMsgStr=<br><b>类别已添加成功！</b>|parent|3000|500||")
end if
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>类别管理</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="./../kindeditor/kindeditor.js"></script>
</head>
<body>
  <div id="frame_Toolbar" class="toolbarBg"> 
		<a href="javascript:self.history.back();" class="icoBtn_ct"><span class="btnIco btnBack"></span>返回</a> 
		<a href="javascript:self.location.reload();" class="icoBtn_ct"><span class="btnIco btnReload"></span>刷新</a> 
		<span class="split ftSplit" ></span>
  </div>
	<form method="POST" id=form2 name="form2" action="?action=add&ID=<%=ID%>" onSubmit="return Juge(this)">
	<div id="MainContent">
		<table class="cTable_2 table">
			<tr class="cTitle toolbarBg">
				<td colspan="2"><div class="cLeftPadding">添加类别</div>
				</td>
			</tr>
			<tr>
				<td class="tRight"  width="20%">类别名称：</td>
				<td  width="80%"><input name="ClassName" type="text" id="ClassName" style="width:300px;" maxlength="255" />
				<span id="RequiredFieldValidator1" style="color:Red;">*</span></td>
			</tr>
			<tr <%if ProductClassPic_con=False then response.Write("style='display:none'") end if%>>
				<td class="tRight">类别图片：</td>
				<td>
					<div class="left"><input name="pic" type="text" id="pic" style="width:300px;" maxlength="255" /></div>
					<div class="left"><iframe src="Upload_form_lt.asp?n=pic&x=1" height="25" width="350" frameborder="0"></iframe></div>
				</td>
			</tr>
<%if ProductClassIntro_con=True then%>
			<tr>
				<td class="tRight">类别简介：</td>
				<td>
		<script type="text/javascript">
		KE.show({
			id : 'ClassIntro',
			resizeMode : 1,
			items : [
			'source', 'fontname', 'fontsize', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline',
			'removeformat', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
			'insertunorderedlist', 'link', 'unlink', 'emoticons'],
			afterCreate : function(id) {
				KE.blur(id);
			}
		});
	    </script>
		<div class="editor">
		<textarea id="ClassIntro" name="ClassIntro" style="width:450px;height:160px;visibility:hidden;"></textarea>
		</div>
				</td>
			</tr>
<%end if%>			
		</table>
		<div id="cEndToolbar" class="toolbarBg">
      <div class="caButCase">
		    <input type="submit" name="Submit" value="确认保存" class="button">
	      <input type="reset" name="Submit2" value="清空重填" class="button">
      </div>
		</div>
	</div>
	</form>
</body>
</html>
<script language="javascript">
function Juge(theForm)
{
    if(theForm.ClassName.value==""){  
		alert("请填写名称!");  
		theForm.ClassName.focus();  
		return (false);  
	}
}
</script>